/* eslint indent: ["off"] */
/* eslint space-before-function-paren: ["off"] */

// 引入 path 模块，用于处理文件和目录路径
const path = require('path')
// 获取项目根目录
const ROOT_DIR = path.join(__dirname, '..')
// helpers 目录
const HELPERS_DIR = path.join(ROOT_DIR, 'helpers')

// 过滤杀前组数组
const { filterForecaArray } = require(path.join(HELPERS_DIR, 'filterForecaArray.js'))
// 获取幸运和杀前组 id
const { getLuckAndForecastIds } = require(path.join(HELPERS_DIR, 'getLuckAndForecastIds.js'))
// 补齐单个值
const { padSingleValue } = require(path.join(HELPERS_DIR, 'utils.js'))

const getKillGroupAccuracy = (summaryArray, currentNumber) => {
  const { redContinuousLimit2Group, greenReboundRedNonContinuousGroup, greenContinuousGroup } =
    filterForecaArray(summaryArray)

  const {
    lucky_array
    // kill_array,
    // red_continuous_limit_2_group_ids,
    // green_rebound_red_non_continuous_group_ids,
    // green_continuous_group_ids
  } = getLuckAndForecastIds(redContinuousLimit2Group, greenReboundRedNonContinuousGroup, greenContinuousGroup)
  // redContinuousLimit2Group, greenReboundRedNonContinuousGroup, greenContinuousGroup

  // console.log('lucky_array', lucky_array)
  // console.log('kill_array', kill_array)
  // console.log('red_continuous_limit_2_group_ids', red_continuous_limit_2_group_ids)
  // console.log('green_rebound_red_non_continuous_group_ids', green_rebound_red_non_continuous_group_ids)
  // console.log('green_continuous_group_ids', green_continuous_group_ids)

  const luckyArray = JSON.parse(lucky_array)
  const accuracy = luckyArray.includes(padSingleValue(currentNumber)) ? 1 : 0
  // console.log(luckyArray.length)
  return {
    accuracy
  }
}

module.exports = { getKillGroupAccuracy }
